package top.suyarong.ftbqsync.data;


import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum SQLEnum {

    CREATE_TABLE("CREATE TABLE IF NOT EXISTS `ftb_quest_sync` (" +
            "  `id` int NOT NULL AUTO_INCREMENT," +
            "  `player_name` varchar(30) NOT NULL," +
            "  `ftb_data` longblob NOT NULL," +
            "  `astral_data` longblob NOT NULL," +
            "  `locked` tinyint NOT NULL DEFAULT '0'," +
            "  `create_time` datetime DEFAULT CURRENT_TIMESTAMP," +
            "  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP," +
            "  PRIMARY KEY (`id`)," +
            "  UNIQUE KEY `unix_player` (`player_name`) USING BTREE" +
            ")"),

    GET_PLAYER_DATA("select id, player_name, ftb_data, astral_data, create_time, update_time from ftb_quest_sync " +
            "where player_name = ? and locked = 0"),

    CHECK_EXIST("select count(*) from ftb_quest_sync " +
            "where player_name = ?"),

    UPDATE_PLAYER_DATA("update ftb_quest_sync set ftb_data = ?, astral_data = ?, locked = 0 where player_name = ?"),

    LOCK_PLAYER("update ftb_quest_sync set locked = 1 where player_name = ?"),

    NEW_PLAYER_DATA("insert into ftb_quest_sync (player_name, ftb_data, astral_data) values (?, ?, ?)"),


    ;
    private final String sql;


}
